<template>
  <div>
    <!-- 标题/返回按钮 -->
      <div class="barg_header">
        <div class="barg_header_icon">
          <img src="navtopIcon/back.png" @click="goHome">
        </div>
        <div class="barg_header_title">专栏列表</div>
      </div>
      <div class="count_container">
        <div class="news-lists" 
              v-for="(item, index) in news" 
              :key="index"
              @click="gotoNews(item)">
            <div class="news-img">
              <img :src="item.pic" width="100%" height="100%"/>
              <div class="content">
                  <div class="right-title">{{item.title}}</div>
                  <div class="right-desc">{{item.descript}}</div>
                  <div class="btn">查看详情</div>
              </div>
            </div>
          </div>
      </div>
  </div>
</template>

<script>
import PATH from "../router/constant"
export default {
    data() {
        return {
            news: []
        }
    },
    methods: {
        gotoNews(item) {
          var id = item.id
            this.$router.goNext({path:PATH.SELETED,query:{id}})
        },
        goHome(){
          this.$router.goBack()
        },
    },
    mounted() {
        this.$CLIENT.getSpecial().then(res=>{
          this.news = res.data.data
        })
    }
}
</script>

<style scoped>
.news-img {
    position: relative;
    width: 100%;
    height: 10rem;
    margin:0.5rem 0;
}

.count_container
{
    margin-top: 50px;
}

.content {
    position: absolute;
    top: 1rem;
    width: 100%;
    color: white;
    font-size:5rem;
    text-align: center;
}
.right-title {
    width: 6rem;
    margin: 0.8rem auto;
    font-size: 1.2rem;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}
.right-desc {
    width: 6rem;
    margin: 0 auto;
    font-size: 0.8rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.btn {
    width: 3rem;
    height: 1rem;
    margin: 1rem auto;
    font-size: 0.5rem;
    border: 0.05rem solid #fff;
    line-height: 1rem;
    padding: 0 0.2rem;
    border-radius: 1rem;
}

.barg_header
{
  width: 100%;
  height: 50px;
  display: inline-flex;
  justify-content: space-between;
  align-items: center;
  position: fixed;
  top: 0;
  background-color: #fff;
  left: 0;
  z-index: 999;
}

.barg_header_icon
{
  width: 10%;
  height: 100%;
  display: inline-flex;
  justify-content: center;
  align-items: center;
}

.barg_header_icon img
{
  width: 24px;
  height: 24px;
}

.barg_header_title
{
  width: 90%;
  height: 100%;
  text-align: center;
  line-height: 50px;
  font-size: 15px;
}
</style>